package com.moteur.analysersite.performance;

import java.util.ArrayList;
import java.util.List;

public class ThreadMoulinette {
	private List<ConnexionSite> list;
	public static Integer NumberThread = 1000;
	public static Integer overd = 0;
	public static Integer error = 0;
	public static Integer success = 0;
	
	public boolean start(String url, int nbrThreada) {
		list = new ArrayList<ConnexionSite>();
		for (int i = 0; i < nbrThreada; i++) {
			list.add(new ConnexionSite(i + "", url ));
		}
		return true;
	}
	
	public void process(String url, int nbrThreada){
		start(url, nbrThreada);
	
		for(ConnexionSite site : list){
			site.start();
		}
	}
	
	public static void writeResult(){
		synchronized (System.out) {
			System.out.println("overd = "+overd);
			System.out.println("error = "+error);
			System.out.println("success = "+success);
		}
	}
}
